feat(map): Handle json.Number when merging maps #261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you unmarshall a json object using the json.Decoder and the UseNumber function, it will create numbers on the map as a
json.Number
object. This object has helper functions for handling ints and floats. So if a json.Number is encountered, try to handle the type of the number based on the destination.This partially addresses #138 even though it is an old issue.
If this is not something you'd like to have built in that's totally fine, I'm happy to fork or try to build a transformer for this. But figured a PR would be best since others have asked for it in a way and this seemed like a correct way to do it.